package com.myway.dto.product.domain;

import java.util.HashMap;

/**
 * 类名称：SupportBusinessType
 * 类描述：辅营产品类型
 * 创建时间：2016-1-13 上午10:12:43
 * @author jiangyang
 * @version V1.0
 */
public enum SupportBusinessType{
	VIPHOUSE("VIPHOUSE"), //机场贵宾厅

	PAYMEAL("PAYMEAL"),  //付费餐食

	RAPIDLY("RAPIDLY");  //快速登离机
	/**
	 * Alias name. This is the name which will be stored in database.
	 */
	private final String alias;

	/**
	 * A hash map which keep all the action enum with alias name as key.
	 */
	private static HashMap<String, SupportBusinessType> map;

	/**
	 * Construct the hash map at load time
	 */
	static
	{
		map = new HashMap<String, SupportBusinessType>();
		for ( SupportBusinessType type : SupportBusinessType.values() )
		{
			map.put( type.alias, type );
		}
	}

	SupportBusinessType(String alias)
	{
		this.alias = alias;
	}

	@Override
	public String toString()
	{
		return this.alias;

	}

	/**
	 * Return a <code>Action</code> object holding the value of specified alias name
	 * 
	 * @param alias
	 * the alias name of the type
	 * 
	 * @return a <code>Action</code> object holding the value represented by the alias name argument
	 */
	public static SupportBusinessType valueOfAlias(String alias)
	{
		SupportBusinessType type = map.get( alias );

		if ( type == null )
		{
			throw new IllegalArgumentException( "Unknown action alias [" + alias + "]" );
		}

		return type;
	}

	/**
	 * @return the alias
	 */
	public String getAlias()
	{
		return this.alias;
	}

}
